chrome.extension.onRequest.addListener(
  function(request, sender, sendResponse) {
 
	  var selection = window.getSelection();
	  var txt = window.getSelection().toString();
	  TranslateTxt(escape(txt));
  });
 
  function TranslateTxt(selectedTxt) {
 
	  var Url = "https://www.googleapis.com/language/translate/v2?key=" + "AIzaSyD3_KyaIis7pklJsNXt_isG7QzkTYPmf2w" + "&q=" + selectedTxt + "&target=zh-cn";
	  chrome.extension.sendRequest({ 'action': 'translateTxt', 'url': Url }, function handle(response) { });
  }